<?php
// $Id$
/**
 * This file contains {@link ChangeEvent} which is part of the PHP Content 
 * Repository (phpCR), a derivative of the Java Content Repository JSR-170,  
 * and is licensed under the Apache License, Version 2.0.
 *
 * This file is based on the code created for
 * {@link http://www.jcp.org/en/jsr/detail?id=170 JSR-170}
 *
 * @author Travis Swicegood <travis@domain51.net>
 * @copyright PHP Code Copyright &copy; 2004-2005, Domain51, United States
 * @copyright Original Java and Documentation 
 *  Copyright &copy; 2002-2004, Day Management AG, Switerland
 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, 
 *      Version 2.0
 * @package phpContentRepository
 * @subpackage Level2
 */

/**
 * Load the {@link phpCR} library file(s)
 */ 
require_once(dirname(__FILE__) . '/../phpCR.library.php');
phpCR::loadInterface('Event', '/event');


/**
 * A subclass of {@link Event} representing a "change" event.
 *
 * Level 2 only
 *
 * Will always be one of the following types:
 * <ul>
 *  <li>{@link EventType::ITEM_ADDED}
 *  <li>{@link EventType::ITEM_CHANGED}
 *  <li>{@link EventType::ITEM_REMOVED}
 * </ul>
 * For details see the {@link ObservationManager} section of the phpCR/JCR 
 * standard document.
 *
 * @author PHP - Travis Swicegood <travis@domain51.net>
 * @copyright Copyright &copy; 2004-2005, Domain51
 * @package phpContentRepository
 * @subpackage Level2
 */
interface ChangeEvent extends Event {

   /**
    * Returns the older item before the changes were made.
    *
    * If this event is of {@link EventType::ITEM_ADDED} then this method 
    * returns NULL.
    *
    * If this event is of {@link EventType::ITEM_CHANGED} then this
    * method returns a copy of the item in question as it was before
    * the change.
    *
    * If this event is of {@link EventType::ITEM_REMOVED} then this
    * method will return the removed item (as will the method
    * {@link Event::getItem()}, that is, they both return the same
    * {@link Item}).
    *
    * @return object|null
    *   An {@link Item} object.
    */
    public function getOldItem();
}
